home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_IIWIZSEC.ASP < prev    next >
Encoding:
Text File  |  1999-06-03  |  21.0 KB  |  716 lines

  1. <%@ LANGUAGE = VBScript %>
  2. <% 'Option Explicit %>
  3. <!-- #include file="directives.inc" -->
  4.  
  5. <% if Session("FONTSIZE") = "" then %>
  6.     <!--#include file="iito.inc"-->
  7. <% else %>
  8. <!-- localizable strings for generic wizard functionality -->
  9. <!--#include file="iiwiz.inc"-->
  10. <!--#include file="iiwiz.str"-->
  11.  
  12. <!-- localizable strings for new node wizard functionality -->
  13. <!--#include file="iiwizsec.inc"-->
  14. <!--#include file="iiwizsec.str"-->
  15.  
  16. <!-- generic wizard global vars and functions -->
  17. <!--#include file="iiwizfncs.inc"-->
  18.  
  19. <%
  20. Const MD_PATH_NOT_FOUND = &H80070003
  21. Const STR_FTP_SERVER_U = "IISFTPSERVER"
  22. Const STR_SLASH_ROOT = "/ROOT"
  23.  
  24. '***************Required custom functions***************
  25. Function sFinish()
  26.     On Error Resume Next
  27.     Dim oSite, thispath, strTemplate
  28.  
  29.     thispath = Request("ADSPath")
  30.     strTemplate = Request("Template")
  31.  
  32.     Dim currentobj, path, dirkeytype
  33.     set currentobj = GetObject(thispath)
  34.  
  35.     path = thispath    
  36.     dirkeytype = sGetKeyType(fixSiteType(Session("stype")), DIR)
  37.     
  38.     ' DBG
  39. '    Response.write "Session,stype - " & Session("stype") & "<BR>"
  40. '    Response.write "dirkeytype - " & dirkeytype & "<BR>"
  41. '    Response.write "currentobj.ADsPath - " & currentobj.ADsPath & "<BR>"
  42.  
  43.     %>
  44.     <!--#include file="iifixpth.inc"-->
  45.     <%
  46.  
  47.     err.clear
  48.     set oSite = GetObject(thispath)
  49.  
  50.     ' DBG
  51. '    Response.write "oSite.ADsPath - " & oSite.ADsPath & "<BR>"
  52. '    Response.write "oSite.KeyType -  " & oSite.KeyType & "<BR>"
  53.     
  54.     if cInt(Request("HowSet")) = INHERITVALS then
  55.  
  56.         ' Handle Web and Ftp cases separately
  57.         if InStr( oSite.KeyType, "Web" ) <> 0 then
  58.         
  59.             ' All web security settings are on the directory
  60.             if InStr(oSite.KeyType,"Server") <> 0 then
  61.                 set oSite = GetObject( thispath & STR_SLASH_ROOT )
  62.             end if
  63.             
  64.             oSite.PutEx ADS_PROPERTY_CLEAR, "AccessFlags", ""
  65.             oSite.PutEx ADS_PROPERTY_CLEAR, "IPSecurity", ""        
  66.             oSite.PutEx ADS_PROPERTY_CLEAR, "AuthFlags", ""
  67. '            oSite.PutEx ADS_PROPERTY_CLEAR, "EnableDirBrowsing", ""
  68.  
  69.             oSite.SetInfo
  70.         else
  71.             
  72.             if InStr(oSite.KeyType,"Server") <> 0 then
  73.                 ' Ftp authorization set at the server level.
  74.                 oSite.PutEx ADS_PROPERTY_CLEAR, "AllowAnonymous", ""
  75.                 oSite.PutEx ADS_PROPERTY_CLEAR, "AnonymousOnly", ""
  76.                 
  77.                 oSite.SetInfo
  78.  
  79.                 set oSite = GetObject( thispath & STR_SLASH_ROOT )
  80.             end if
  81.  
  82.             ' Ftp access set at the directory
  83.             oSite.PutEx ADS_PROPERTY_CLEAR, "AccessFlags", ""
  84.             oSite.SetInfo
  85.             
  86.         end if
  87.     else
  88.         dim frompath, topath, propstr
  89.         ' Handle Web and Ftp cases separately
  90.         if InStr( oSite.KeyType, "Web" ) <> 0 then
  91.  
  92.             if InStr(oSite.Class,"Server") <> 0 then
  93.                 set oSite = GetObject( thispath & STR_SLASH_ROOT )
  94.             end if
  95.  
  96.             frompath = "sFromNode=" & Server.URLEncode(strTemplate & STR_SLASH_ROOT)
  97.             topath = "&sToNode=" & Server.URLEncode(oSite.ADsPath)
  98.             propstr = "&prop=AuthFlags,AccessFlags"                 ' ,EnableDirBrowsing
  99.             
  100.             Response.write SCRIPT & "top.hlist.location.href='iiclone.asp?" & frompath & topath & propstr & "';" & CLOSESCRIPT
  101.         else
  102.             ' Because FTP has security settings at both the server and vdir levels the
  103.             ' generic clone script won't work to copy settings, so we'll set them here
  104.             
  105.             Dim objTemplate
  106.             
  107.             ' DBG
  108. '            Response.write "Template " & strTemplate & "<BR>"
  109. '            Response.write "Site " & oSite.ADsPath & "<BR>"
  110.  
  111.             if STR_FTP_SERVER_U = UCase(oSite.Class) then
  112.                 ' Authentication properties need to be set on the server
  113.                 set objTemplate = GetObject( strTemplate )
  114.                 
  115.                 oSite.AllowAnonymous = objTemplate.AllowAnonymous
  116.                 oSite.AnonymousOnly = objTemplate.AnonymousOnly
  117.                 oSite.SetInfo
  118.                     
  119.                 ' Set target object to /ROOT for directory specific propeties
  120.                 set oSite = GetObject( oSite.ADsPath & STR_SLASH_ROOT )
  121.             end if
  122.                 
  123.             set objTemplate = GetObject( strTemplate & STR_SLASH_ROOT )
  124.  
  125.             oSite.AccessFlags = objTemplate.AccessFlags
  126.             oSite.SetInfo
  127.         end if
  128.     end if
  129.     if err = 0 then
  130.         %>
  131.         <SCRIPT LANGAUGE="JavaScript">
  132. //        top.window.close();
  133.         </SCRIPT>
  134.         <%
  135.     else
  136.         sHandleErrors(err)
  137.     end if    
  138. End Function
  139.  
  140. Function sHandleErrors(errnum)
  141.     Response.write L_ERROROCCURED & errnum & "(" & HEX(errnum) & ")"
  142. End Function
  143.  
  144. Function sWriteWelcome()
  145.     Dim sOutputStr
  146.     
  147.     sOutputStr = sFont("2","","",True)
  148.     sOutputStr = sOutputStr & "<B>" & L_WELCOME_HEAD & "</B><P>"
  149.     sOutputStr = sOutputStr & sFont("","","",True)    
  150.     sOutputStr = sOutputStr & L_WELCOME1 & "<P>"    
  151.     sOutputStr = sOutputStr & L_WELCOME2 & "<P>"
  152.     sOutputStr = sOutputStr & L_WELCOME3 & "<P>"
  153.  
  154.     sWriteWelcome = sOutputStr            
  155.     
  156. End Function
  157.  
  158. Function sWriteFinish()
  159.     Dim sOutputStr
  160.     
  161.     sOutputStr = sFont("2","","",True)
  162.     sOutputStr = sOutputStr & "<B>" & L_FINISH_HEAD & "</B><P>"
  163.     sOutputStr = sOutputStr & sFont("","","",True)    
  164.     sOutputStr = sOutputStr & L_FINISH1 & "<P>"    
  165.     sOutputStr = sOutputStr & L_FINISH2 & "<P>"
  166.     sOutputStr = sOutputStr & L_FINISH3 & "<P>"
  167.  
  168.     sWriteFinish = sOutputStr            
  169.     
  170. End Function
  171.  
  172. Function sWriteTitle(iThisPage)
  173.     Dim sOutputStr, sHead, sDescription, iNodeType
  174.  
  175.     Select Case iThisPage
  176.         Case HOW
  177.             sHead = L_HOW 
  178.             sDescription = L_HOW_DESC 
  179.         Case TEMPLATE
  180.             sHead = L_TEMPLATE 
  181.             sDescription = L_TEMPLATE_DESC 
  182.         Case ACL
  183.             sHead = L_ACL 
  184.             sDescription = L_ACL_DESC 
  185.         Case SUMMARY
  186.             sHead = L_SUMMARY
  187.             sDescription = L_SUMMARY_DESC             
  188.  
  189.     End Select    
  190.     
  191.     sOutputStr = "<TABLE WIDTH = 100% CELLPADDING = 0 CELLSPACING=0>"
  192.     sOutputStr = sOutputStr & "<TR>"
  193.     sOutputStr = sOutputStr & "<TD ALIGN=left VALIGN=top bgcolor='White'>"
  194.  
  195.     sOutputStr = sOutputStr & "<TABLE CELLPADDING = 0 CELLSPACING=0 >"
  196.     sOutputStr = sOutputStr & "<TR>"
  197.     sOutputStr = sOutputStr & "<TD COLSPAN = 2 bgcolor='White'><BR>"
  198.     sOutputStr = sOutputStr & sFont("","","",True)
  199.     sOutputStr = sOutputStr & "<B>" & sHead & "</B>"
  200.     sOutputStr = sOutputStr & "</FONT>"
  201.     sOutputStr = sOutputStr & "</TD>"
  202.     sOutputStr = sOutputStr & "</TR>"
  203.         
  204.     sOutputStr = sOutputStr & "<TR>"
  205.     sOutputStr = sOutputStr & "<TD width = 10 bgcolor='White'> </TD>"
  206.     sOutputStr = sOutputStr & "<TD bgcolor='White'>"
  207.     sOutputStr = sOutputStr & sFont("","","",True)
  208.     sOutputStr = sOutputStr & sDescription
  209.     sOutputStr = sOutputStr & "</FONT>"
  210.     sOutputStr = sOutputStr & "</TD>"
  211.     sOutputStr = sOutputStr & "</TR>"
  212.     sOutputStr = sOutputStr & "</TABLE>"    
  213.     
  214.     sOutputStr = sOutputStr & "</TD>"
  215.     sOutputStr = sOutputStr & "<TD WIDTH = 74 BGCOLOR='Teal'>"
  216.     
  217.     sOutputStr = sOutputStr & "<IMG SRC='images/websitehd.GIF' WIDTH=74 HEIGHT=59 BORDER=0>"
  218.     sOutputStr = sOutputStr & "</TD>"
  219.  
  220.     sOutputStr = sOutputStr & "</TR>"
  221.     sOutputStr = sOutputStr & "</TABLE>"    
  222.     
  223.     sWriteTitle = sOutputStr
  224.     
  225. End Function
  226.  
  227. Function sWritePage(iThisPage)
  228.     'On Error Resume Next
  229.     
  230.     Dim sOutputStr, bCanAddSite, isSite, oParentNode, iNodeTypeDefault, sParentKeyType, sNameText
  231.     Dim i
  232.     Dim bSelected, sSelDescription, oTemplates, oTemplate
  233.     Dim oIPSec, bGrantByDefault, aIPList, aDomainList, sIPRestrict
  234.  
  235.     sOutputStr = sOutputStr & "<TABLE CELLPADDING = 0 CELLSPACING=0 >"
  236.     sOutputStr = sOutputStr & "<TR>"
  237.     sOutputStr = sOutputStr & "<TD WIDTH = 10> </TD>"
  238.     sOutputStr = sOutputStr & "<TD>"    
  239.     
  240.     sOutputStr = sOutputStr & "<TABLE CELLPADDING = 0 CELLSPACING=0 BORDER=0>"
  241.     sOutputStr = sOutputStr & "<TR>"
  242.     sOutputStr = sOutputStr & "<TD> "
  243.     sOutputStr = sOutputStr & "</TD>"
  244.     sOutputStr = sOutputStr & "</TR>"
  245.     
  246.     Select Case iThisPage
  247.         Case HOW
  248.             iNextPage = SUMMARY
  249.         
  250.             if Request("HowSet") <> "" then            
  251.                 if cInt(Request("HowSet")) = TEMPLATEVALS then
  252.                     iNextPage=TEMPLATE
  253.                 end if
  254.             end if
  255.             
  256.             if Session("stype")="www" then                
  257.                 sOutputStr = sOutputStr & sRadio("HowSet", INHERITVALS, L_INHERITWEB, INHERITVALS, "clearTemplate();iNextPage=" & SUMMARY)                
  258.                 sOutputStr = sOutputStr & sRadio("HowSet", TEMPLATEVALS, L_TEMPLATESWEB, INHERITVALS, "iNextPage=" & TEMPLATE)
  259.             else
  260.                 sOutputStr = sOutputStr & sRadio("HowSet", INHERITVALS, L_INHERITFTP, INHERITVALS, "clearTemplate();iNextPage=" & SUMMARY)                
  261.                 sOutputStr = sOutputStr & sRadio("HowSet", TEMPLATEVALS, L_TEMPLATESFTP, INHERITVALS, "iNextPage=" & TEMPLATE)
  262.             end if
  263.             
  264.         Case TEMPLATE
  265.             sOutputStr = sOutputStr & sSelect("Template", 5, "setTemplateDesc(this,document.userform.TemplateSample);", FALSE)
  266.             
  267.             if Session("stype")="www" then                            
  268.                 set oTemplates = GetObject("IIS://localhost/w3svc/info/templates")
  269.             else
  270.                 set oTemplates = GetObject("IIS://localhost/MSFTPsvc/info/templates")
  271.             end if
  272.             bSelected = True
  273.             for each oTemplate in oTemplates
  274.                 if Request("Template") <> "" then
  275.                     if oTemplate.ADsPath = Request("Template") then
  276.                         bSelected = True
  277.                     end if
  278.                 end if
  279.                 sOutputStr = sOutputStr & sOption(oTemplate.Name,oTemplate.ADsPath,bSelected)
  280.                 if bSelected then
  281.                     sSelDescription = oTemplate.ServerComment
  282.                 end if
  283.                 bSelected = False
  284.             next
  285.             
  286.             sOutputStr = sOutputStr & closeSelect()
  287.             sOutputStr = sOutputStr & "<TR>"
  288.             sOutputStr = sOutputStr & "<TD> "
  289.             
  290.             for each oTemplate in oTemplates
  291.                sOutputStr = sOutputStr & "<INPUT TYPE='hidden' NAME='" & Replace(oTemplate.Name," ","") & "' VALUE='" &  oTemplate.ServerComment & "'>"
  292.             next
  293.             
  294.             sOutputStr = sOutputStr & "</TD>"
  295.             sOutputStr = sOutputStr & "</TR>"                                
  296.             sOutputStr = sOutputStr & sTextArea("TemplateSample", L_SAMPLETEMPLATE, sSelDescription,5,55, not ENABLED)
  297.             
  298.             
  299.         Case ACL
  300.             sOutputStr = sOutputStr & sStaticText(L_RECOMMENDED,not BOLD)
  301.             sOutputStr = sOutputStr & sStaticText(RECOMMENDEDACLS1,BOLD)
  302.             sOutputStr = sOutputStr & sStaticText(RECOMMENDEDACLS2,BOLD)
  303.             
  304.             sOutputStr = sOutputStr & sRadio("ACLSet", REPLACEACLS, L_REPLACEACLS, REPLACEACLS, "")
  305.             sOutputStr = sOutputStr & sSpace(1)                
  306.             sOutputStr = sOutputStr & sRadio("ACLSet", ADDACLS, L_ADDACLS, REPLACEACLS, "")
  307.             sOutputStr = sOutputStr & sSpace(1)                            
  308.             sOutputStr = sOutputStr & sRadio("ACLSet", NOACLS, L_NOCHANGEACLS, REPLACEACLS, "")
  309.             
  310.             if cInt(Request("HowSet")) = INHERITVALS then
  311.                     iPrevPage = HOW
  312.             end if
  313.             
  314.         Case SUMMARY
  315.         
  316.             sOutputStr = sOutputStr & sStaticText(L_SUMMARYWARNING_TEXT, not BOLD)
  317.             sTemplatePath = Request("Template")
  318.  
  319.             ' DBG
  320. '            Response.write " Request,Template - " & Request("Template") & "<BR>"
  321.  
  322.             if sTemplatePath = "" then
  323.                 sTemplatePath = sGetParentPath(Request("ADsPath"))
  324.             else
  325.                 ' The only case when the configuration isn't available at the vdir
  326.                 ' is ftp authentication. Make that a special case, below.
  327.                 sTemplatePath = sTemplatePath & STR_SLASH_ROOT
  328.             end if
  329.             
  330.             set oTemplate = GetObject(sTemplatePath)
  331.  
  332.             ' DBG
  333. '            Response.write oTemplate.ADsPath & " - " & oTemplate.Class & "<BR>"
  334. '            Response.write "ADSPath - " & Request("ADSPath") & "<BR>"
  335.  
  336.             sSummary = ""
  337.             
  338.             ' BUGBUG - The KeyType for the template\root is not being set. Getting the
  339.             ' Class will work around the problem, but setup should be changed to set
  340.             ' the KeyType.
  341.             if InStr(oTemplate.Class,"Web")<> 0 then
  342.                 'Authentication Methods
  343.                 sSummary = sSummary & sAddSummaryLine(True,L_AUTHENTICATIONMETHODS)                
  344.                 sSummary = sSummary & sAddSummaryLine(oTemplate.AuthAnonymous,INDENT &L_ANONAUTH)            
  345.                 sSummary = sSummary & sAddSummaryLine(oTemplate.AuthBasic,INDENT &L_BASICAUTH)
  346.                 sSummary = sSummary & sAddSummaryLine(oTemplate.AuthNTLM,INDENT &L_NTLMAUTH)
  347.                 sSummary = sSummary & sAddSummaryLine(oTemplate.AuthMD5,INDENT &L_DIGESTAUTH)
  348.             else
  349.                 ' Ftp authentication only happens on the server node
  350.                 Dim oTheNode, oTempTemplate
  351.                 set oTheNode = GetObject( Request("ADSPath") )
  352.                 
  353.                 ' DBG
  354. '                Response.write oTheNode.ADsPath & " - " & oTheNode.Class & "<BR>"
  355.                 
  356.                 if InStr(oTheNode.Class, "Server") <> 0 then
  357.                     if Request("Template") = "" then
  358.                         ' Using values from the service
  359.                         set oTempTemplate = oTemplate
  360.                     else
  361.                         set oTempTemplate = GetObject( Request("Template") )
  362.                     end if
  363.  
  364.                     sSummary = sSummary & sAddSummaryLine( True, L_AUTHENTICATIONMETHODS )
  365.                     sSummary = sSummary & sAddSummaryLine( oTempTemplate.AllowAnonymous, INDENT & L_ANONAUTH )
  366.                     sSummary = sSummary & sAddSummaryLine( oTempTemplate.AnonymousOnly, INDENT & L_ANONONLY )
  367.                 end if
  368.             end if
  369.             
  370.             'Access Control
  371.             sSummary = sSummary & sAddSummaryLine(True,L_ACCESSPERMS)                
  372.             sSummary = sSummary & sAddSummaryLine(oTemplate.AccessRead,INDENT & L_READACCESS)            
  373.             sSummary = sSummary & sAddSummaryLine(oTemplate.AccessWrite,INDENT & L_WRITEACCESS)
  374.             if InStr(oTemplate.Class,"Web")<> 0 then            
  375.                 sSummary = sSummary & sAddSummaryLine(oTemplate.AccessSource and oTemplate.AccessRead,INDENT & L_SOURCEREADACCESS)
  376.                 sSummary = sSummary & sAddSummaryLine(oTemplate.AccessSource and oTemplate.AccessWrite,INDENT & L_SOURCEWRITEACCESS)            
  377.                 sSummary = sSummary & sAddSummaryLine(oTemplate.AccessScript, INDENT & L_SCRIPTACCESS)
  378.                 sSummary = sSummary & sAddSummaryLine(oTemplate.AccessExecute, INDENT & L_EXECUTEACCESS)                        
  379. '                sSummary = sSummary & sAddSummaryLine(oTemplate.EnableDirBrowsing,INDENT & L_DIRBROWSE)
  380.             end if
  381.  
  382.             ' IP Restrictions
  383.             sSummary = sSummary & L_IPSECURITY & L_RETURN
  384.             
  385.             Set oIPSec = oTemplate.IPSecurity
  386.             bGrantByDefault = oIPSec.GrantByDefault
  387.  
  388.             if bGrantByDefault then
  389.                 sSummary = sSummary & INDENT & L_IPSECGRANTDEFAULT & L_RETURN
  390.                 aIPList = oIPSec.IPDeny
  391.                 aDomainList = oIPSec.DomainDeny
  392.                 sIPRestrict = L_IPSECDENIED
  393.             else
  394.                 sSummary = sSummary & INDENT & L_IPSECDENYDEFAULT & L_RETURN
  395.                 aIPList = oIPSec.IPGrant
  396.                 aDomainList = oIPSec.DomainGrant
  397.                 sIPRestrict = L_IPSECGRANTED
  398.             end if
  399.             
  400.             if IsArray( aDomainList ) then
  401.                 for i = LBound(aDomainList) to UBound(aDomainList)
  402.                     sSummary = sSummary & INDENT & Replace( sIPRestrict, STR_SUBST, aDomainList(i), 1, 1 ) & L_RETURN
  403.                 next
  404.             end if
  405.             
  406.             if IsArray( aIPList ) then
  407.                 for i = LBound(aIPList) to UBound(aIPList)
  408.                     sSummary = sSummary & INDENT & Replace( sIPRestrict, STR_SUBST, sGetIPString(aIPList(i)), 1, 1 ) & L_RETURN
  409.                 next
  410.             end if
  411.             
  412.             sOutputStr = sOutputStr & sTextArea("SummaryArea", "", sSummary, L_SUMMARYROWS_NUM, L_SUMMARYCOLS_NUM, not ENABLED)
  413.             if cInt(Request("HowSet")) = INHERITVALS then
  414.                     iPrevPage = HOW
  415.             end if
  416.             
  417.     End Select
  418.     
  419.     sOutputStr = sOutputStr + "</TABLE>"
  420.     sOutputStr = sOutputStr & "</TD>"        
  421.     sOutputStr = sOutputStr & "</TR>"        
  422.     sOutputStr = sOutputStr & "</TABLE>"        
  423.     
  424.  
  425.     sWritePage = sOutputStr
  426.  
  427. End Function
  428.  
  429.  
  430. '***************Optional Custom Functions***************
  431. Function sAddSummaryLine(bAddIt,sText)
  432.     Dim sSummLine
  433.     sSummLine = ""
  434.     if bAddIt then
  435.             sSummLine = sText & L_RETURN
  436.     end if
  437.     sAddSummaryLine = sSummLine    
  438. End Function
  439.  
  440. Function sGetParentPath(sCurPath)
  441.     Dim sParentPath
  442.     sParentPath = Left(sCurPath,InStrRev(sCurPath,"/")-1)
  443.     if len(sParentPath)+1 = len(sCurPath) then
  444.         sParentPath = Left(sCurPath,InStrRev(sCurPath,"/")-1)        
  445.     end if
  446.     sGetParentPath = sParentPath
  447. End Function
  448.  
  449. Function sGetNextInstanceName(iSiteType)
  450.     On Error Resume Next
  451.  
  452.     Dim oService,oInst, sInstName
  453.  
  454.     Set oService=GetObject(BASEPATH & SERVICES(iSiteType))
  455.     For Each oInst In oService
  456.         if isNumeric(oInst.Name) and oInst.Name > sInstName then
  457.             sInstName=oInst.Name
  458.         end if
  459.     Next
  460.  
  461.     sGetNextInstanceName=cInt(sInstName)+1    
  462. End Function
  463.  
  464. 'Return an appropriately formated keytype
  465. Function sGetKeyType(iSiteType, iNodeType)
  466.     Dim sSvcKey
  467.  
  468.     sSvcKey = SERVICES(iSiteType)
  469.     Select Case iNodeType    
  470.          Case SITE 
  471.             sGetKeyType=IIS & sSvcKey & SSITE
  472.         Case VDIR
  473.             sGetKeyType=IIS & sSvcKey & SVDIR
  474.         Case DIR
  475.             sGetKeyType=IIS & sSvcKey & SDIR
  476.     End Select
  477. End Function
  478.  
  479.  
  480. 'this is a goofy function to fix the session type we get passed in.
  481. 'these have gotten really out of hand. Should go through entire
  482. 'system and fix this, so that if we are referincing the site type
  483. 'it is ALWAYS W3SVC or MSFTPSVC... not sometimes web, sometimes www
  484. 'and sometimes w3svc... ick. sorry.
  485.  
  486. Function fixSiteType(sessionSite)
  487.     sessionSite = LCase(sessionSite)
  488.     if sessionSite = "ftp" then
  489.         fixSiteType = 1
  490.     end if
  491.     if sessionSite = "www" then
  492.         fixSiteType = 0
  493.     end if    
  494. End Function    
  495.  
  496. Function sGetPhysPath(oParentNode, sDirName)
  497.  
  498.     Dim sParentType, sNewPath, sBasePath
  499.     'The physical directory may not currently
  500.     'exist in the metabase, so we have
  501.     'to find the parent vdir associated with
  502.     'the dir and build the path from there.    
  503.  
  504.  
  505.     sParentType = oParentNode.KeyType
  506.     sNewPath = sDirName
  507.     sBasePath = oParentNode.ADsPath
  508.     Do Until Instr(sParentType, SVDIR) <> 0            
  509.             'we need clear our path not found error..
  510.             err = 0            
  511.             
  512.             'add our initial whack...
  513.             sNewPath = "/" + sNewPath
  514.             
  515.             'and cyle through the baseobj till we find the next whack,
  516.             'building up the path in new name as we go
  517.             
  518.             Do Until Right(sBasePath,1) = "/"
  519.                 sNewPath = Right(sBasePath,1) & sNewPath
  520.                 sBasePath = Mid(sBasePath,1,Len(sBasePath)-1)
  521.             Loop
  522.             'once we're out, we need to lop off the last whack...
  523.             sBasePath = Mid(sBasePath,1,Len(sBasePath)-1)
  524.             
  525.             'and try to set the object again...
  526.             Set oParentNode=GetObject(sBasePath)
  527.             
  528.             if err <> 0 then            
  529.                 sParentType = ""
  530.             else
  531.                 sParentType=oParentNode.KeyType
  532.             end if                             
  533.         Loop
  534.         sGetPhysPath = oParentNode.Path & "\" & sNewPath
  535.         err.clear
  536. End Function
  537.  
  538. function sGetIPString(bindstr)
  539.     dim one, ip, sn
  540.     
  541.     one=Instr(bindstr,",")
  542.     if one > 0 then
  543.         ip=Trim(Mid(bindstr,1,(one-1)))
  544.         sn=Trim(Mid(bindstr,(one+1)))
  545.         if sn = "255.255.255.255" then
  546.             sn = ""
  547.         end if
  548.         if sn <> "" then
  549.             ip = ip & " (" & sn & ")"
  550.         end if
  551.     else
  552.         ip=bindstr
  553.     end if
  554.     sGetIPString = ip
  555. end function
  556.  
  557. '***************End***************
  558. %>
  559.  
  560. <html>
  561. <head>
  562.     <title><%= L_WIZARD_TEXT %></title>
  563.     
  564.  
  565.     <%= SCRIPT %>
  566.         
  567.     function bNextPageOk()
  568.     {
  569.     return true;
  570.     }
  571.     
  572.     function setTemplateDesc(selControl,descControl)
  573.     {
  574.         selControlText = new String(selControl.options[selControl.selectedIndex].text)
  575.         selControlText = myReplace(selControlText," ","");
  576.         descControl.value = document.userform[selControlText].value;
  577.     }
  578.     
  579.     function clearTemplate()
  580.     {
  581.         document.userform.Template.value = "";
  582.     }
  583.     
  584.     function myReplace(sCntrl,sToReplace,sReplaceWith)
  585.     {
  586.         <% 'Jscript 3.0 doesn't support the standard replace funciton... %>
  587.             sNew = ""
  588.             for (i=0;i<=sCntrl.length;i++)
  589.             {
  590.                 if (sCntrl.substring(i,i+1) == sToReplace)
  591.                 {
  592.                     sNew += sReplaceWith;
  593.                 }
  594.                 else
  595.                 {
  596.                     sNew += sCntrl.substring(i,i+1);
  597.                 }
  598.             }
  599.             return sNew;
  600.     }
  601. <%= CLOSESCRIPT %>
  602.  
  603. </head>
  604.  
  605. <body bgcolor="#CCCCCC" topmargin=0 leftmargin=0>
  606.  
  607. <% if Session("IsIE") and Session("browserver") < 4 then %>
  608. <table border = 1 width="100%" height="100%" cellpadding=0 cellspacing=0>
  609. <% else %>
  610. <table border = 0 width="100%" height="100%" cellpadding=0 cellspacing=0>
  611. <% end if %>
  612. <form name="userform" method="POST" action="iiwizsec.asp"><!-- data persistences --><!--#include file="iiwizsec.dat"--><!-- end data persistences -->
  613. <% Select Case iThisPage %>
  614.  
  615. <% Case WELCOME %>
  616.     <tr>
  617.         <td bgcolor="teal" height=310 width = 163>
  618.         <IMG SRC="images/Website.gif" WIDTH=163 HEIGHT=312>
  619.         </td>
  620.         
  621.         <td bgcolor="White" ALIGN=left VALIGN=top>
  622.             <TABLE CELLPADDING = 2 CELLSPACING=0 >
  623.                 <TR>
  624.                     <TD COLSPAN = 2> 
  625.                     </TD>
  626.                 </TR>
  627.                 <TR>
  628.                     <TD WIDTH = 18> 
  629.                     </TD>
  630.                     <TD>
  631.                         <%= sWriteWelcome() %>
  632.                     </TD>                    
  633.                 </TR>
  634.             </TABLE>
  635.         </td>
  636.     </tr>
  637.     
  638. <% Case FINISH %>
  639. <% 
  640.     ' We need to use a finish page not only to make this consistent with MMC,
  641.     ' but also to allow the iiclone.asp script to execute. If the dialog is
  642.     ' dismissed in sFinish() the iiclone script may not complete if it is called
  643.     ' twice.
  644. %>
  645.     <tr>
  646.         <td height=315 width = 164><IMG SRC="images/website.gif" BORDER=0 HSPACE=0 VSPACE=0></td>
  647.         
  648.         <td bgcolor="White" ALIGN=left VALIGN=top>
  649.             <TABLE CELLPADDING = 2 CELLSPACING=0>
  650.                 <TR>
  651.                     <TD COLSPAN = 2> 
  652.                     </TD>
  653.                 </TR>
  654.                 <TR>
  655.                     <TD WIDTH = 18> 
  656.                     </TD>
  657.                     <TD>
  658.                         <%= sFinish() %>                        
  659.                         <%= sWriteFinish() %>
  660.                     </TD>                    
  661.                 </TR>
  662.             </TABLE>
  663.         </td>
  664.     </tr>
  665. <% Case Else %>
  666.     <tr>
  667.     <TD HEIGHT=315 COLSPAN = 2 VALIGN="top">
  668.  
  669.         <TABLE WIDTH = 100% cellspacing=0 cellpadding=0 cellspacing=0>
  670.         <tr bgcolor="#FFFFFF">
  671.             <td bgcolor="#FFFFFF" width = 10> </td>
  672.             <td bgcolor="#FFFFFF" height = 59 ALIGN=left VALIGN=top>
  673.                 <%= sWriteTitle(iThisPage) %>
  674.             </td>
  675.         </tr>
  676.         <tr>
  677.             <td height = 1 colspan = 2 bgcolor="Gray"></td>
  678.         </tr>
  679.         <tr>
  680.             <td height = 1 colspan = 2 bgcolor="White"></td>
  681.         </tr>
  682.         
  683.         <tr>
  684.             <td> </td>
  685.             <td height=220 ALIGN=left VALIGN=top>
  686.                 <%= sWritePage(iThisPage) %>
  687.             </td>
  688.         </tr>
  689.         </TABLE>
  690.     </TD>
  691.     </TR>    
  692.  
  693. <% end Select %>
  694. <% if Session("IsIE") and Session("browserver") < 4 then %>
  695. <% ' IE3 doesn't do the line well... we're using table-borders instead. %>
  696. <% else %>
  697. <tr>
  698.     <td height = 1 colspan = 2 bgcolor="Gray"></td>
  699. </tr>
  700. <tr>
  701.     <td height = 1 colspan = 2 bgcolor="White"></td>
  702. </tr>
  703.  
  704. <% end if %>
  705. <!-- generic wizard buttons -->
  706. <!--#include file="iiwizbtns.inc"-->
  707.  
  708. </table>
  709. </blockquote>
  710. </form>
  711. </body>
  712.  
  713. </html>
  714.  
  715. <% end if %>
  716.